package org.geektimes.projects.user.validator.bean.validation.annotations;

import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * custom phone number validator annotation
 *
 * @author biwin
 * @see {@link ConstraintValidator}
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = PhoneValidAnnotationValidator.class)
public @interface PhoneValid {

    int min() default 11;

    int max() default 11;

    String message() default "The Phone Number Must Be 11 Digits";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
